import 'package:flutter/material.dart';
import 'package:flutter_food_ordering_web/res/colors.dart';
import 'package:flutter_food_ordering_web/res/dimens.dart';
import 'package:flutter_food_ordering_web/res/styles.dart';
import 'package:flutter_food_ordering_web/routers/fluro_navigator.dart';
import 'package:pretty_qr_code/pretty_qr_code.dart';

class MyTakeFoodDialog extends StatefulWidget {

  String data;
  String number;

  MyTakeFoodDialog({Key key,
    this.data,
    this.number
  }) : super(key: key);

  @override
  _MyTakeFoodDialogState createState() => _MyTakeFoodDialogState();
}

class _MyTakeFoodDialogState extends State<MyTakeFoodDialog> {
  @override
  Widget build(BuildContext context) {
    return Material( //创建透明层
      // type: MaterialType.transparency, //透明类型
      color: Color(0x33eeefcb),
      child: new Center( //保证控件居中效果
        child: Container(
          width: 320.5,
          height: 189.5,
          decoration: BoxDecoration(
            color: Colors.white,
            border: Border.all(color: Color(0x69979797), width: 1)
          ),
          child: Stack(
            children: <Widget>[
              Positioned(
                top: 10,
                right: 10,
                child: InkWell(
                  onTap: () {
                    NavigatorUtils.goBack(context);
                  },
                  child: Icon(Icons.close,
                    color: Color(0xffd8d8d8),
                    size: 16,
                  )
                )
              ),
              Positioned(
                top: 0,
                left: 0,
                right: 0,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: <Widget>[
                    SizedBox(height: 16.5),
                    Container(
                      width: 86,
                      height: 16.5,
                      decoration: BoxDecoration(
                        color: Color(0xff993301),
                        borderRadius: BorderRadius.circular(3)
                      ),
                      child: Center(
                        child: Text('下单成功',
                          style: TextStyle(
                            fontSize: Dimens.font_sp12,
                            color: Colors.white
                          ),
                        ),
                      ),
                    ),
                    SizedBox(height: 15),
                    PrettyQr(
                      size: 66,
                      data: widget.data
                    ),
                    SizedBox(height: 15),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: <Widget>[
                        Container(
                          width: 37,
                          height: 11.5,
                          decoration: BoxDecoration(
                            color: Color(0xff92d9f5),
                            borderRadius: BorderRadius.circular(3)
                          ),
                          child: Center(
                            child: Text('取餐码',
                              style: TextStyle(
                                fontSize: 9,
                                color: Colors.white
                              ),
                            ),
                          ),
                        ),
                        SizedBox(width: 18.5),
                        Text('${widget.number}', style: TextStyles.textBoldDark20),
                        SizedBox(width: 18.5 + 37)
                      ],
                    ),
                    Text('请于明天中午到金东食堂阿姨处通过输\n入取餐码或者扫描二维码领取您的午餐',
                      textAlign: TextAlign.center,
                      style: TextStyle(
                        fontSize: 8,
                        color: Colours.text_dark
                      ),
                    )
                  ],
                )
              )
            ],
          ),
        ),
      )
    );
  }
}